package tedu.study.ooday04;

public class UploadDemo {
    public static void main(String[] args) {
        Eoo ooo = new Foo();
        ooo.show();



        Eoo o1 = new Eoo();
        o1.a = 1;
        //o1.show();
        //o1.b = 2;
        //o1.test();//编译错误，超类不能访问派生类的

        Foo o2 = new Foo();
        o2.b = 2;
        //o2.test();
        o2.a = 1;//正确
        //o2.show();//派生类可以访问超类的

      //超类          派生类
        Eoo o3 = new Foo();//先父后子，向上造型
        o3.a = 1;
        o3.show();
        //o3.b = 2;//编译错误
        //o3.test();//编译错误，能点出什么，看引用的类型
        Foo o4 = (Foo)o3;
        o4.b = 9.9;
        Eoo o5 = o4;
        Foo o6 = (Foo)o5;
        System.out.println(o6.b);
        o6.show();


        /*
        Foo f = new Foo();
        f.a = 1;
        f.b = 2;
        System.out.println(f.a);
        System.out.println(f.b);
        f.show();
        f.test();
        Eoo e = f;
        System.out.println(e.a);
        System.out.println(f.a);
        System.out.println(f.b);
        e.show();
        Foo f1 = (Foo)e;
        System.out.println(f1.a);
        System.out.println(f1.b);
        f1.show();
        f1.test();

        */

    }
}
